package com.yaorange.teaching.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yaorange.common.log.annotation.Log;
import com.yaorange.common.log.enums.BusinessType;
import com.yaorange.common.security.annotation.RequiresPermissions;
import com.yaorange.teaching.domain.YaStudentInterviewRecord;
import com.yaorange.teaching.service.IYaStudentInterviewRecordService;
import com.yaorange.common.core.web.controller.BaseController;
import com.yaorange.common.core.web.domain.AjaxResult;
import com.yaorange.common.core.utils.poi.ExcelUtil;
import com.yaorange.common.core.web.page.TableDataInfo;

/**
 * 学生面试题练习记录Controller
 * 
 * @author ruoyi
 * @date 2024-11-22
 */
@RestController
@RequestMapping("/daily_tasks_record")
public class YaStudentInterviewRecordController extends BaseController
{
    @Autowired
    private IYaStudentInterviewRecordService yaStudentInterviewRecordService;

    /**
     * 查询学生面试题练习记录列表
     */
    @RequiresPermissions("teaching:daily_tasks_record:list")
    @GetMapping("/list")
    public TableDataInfo list(YaStudentInterviewRecord yaStudentInterviewRecord)
    {
        startPage();
        List<YaStudentInterviewRecord> list = yaStudentInterviewRecordService.selectYaStudentInterviewRecordList(yaStudentInterviewRecord);
        return getDataTable(list);
    }

    /**
     * 导出学生面试题练习记录列表
     */
    @RequiresPermissions("teaching:daily_tasks_record:export")
    @Log(title = "学生面试题练习记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YaStudentInterviewRecord yaStudentInterviewRecord)
    {
        List<YaStudentInterviewRecord> list = yaStudentInterviewRecordService.selectYaStudentInterviewRecordList(yaStudentInterviewRecord);
        ExcelUtil<YaStudentInterviewRecord> util = new ExcelUtil<YaStudentInterviewRecord>(YaStudentInterviewRecord.class);
        util.exportExcel(response, list, "学生面试题练习记录数据");
    }

    /**
     * 获取学生面试题练习记录详细信息
     */
    @RequiresPermissions("teaching:daily_tasks_record:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(yaStudentInterviewRecordService.selectYaStudentInterviewRecordById(id));
    }

    /**
     * 新增学生面试题练习记录
     */
    @RequiresPermissions("teaching:daily_tasks_record:add")
    @Log(title = "学生面试题练习记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YaStudentInterviewRecord yaStudentInterviewRecord)
    {
        return toAjax(yaStudentInterviewRecordService.insertYaStudentInterviewRecord(yaStudentInterviewRecord));
    }

    /**
     * 修改学生面试题练习记录
     */
    @RequiresPermissions("teaching:daily_tasks_record:edit")
    @Log(title = "学生面试题练习记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YaStudentInterviewRecord yaStudentInterviewRecord)
    {
        return toAjax(yaStudentInterviewRecordService.updateYaStudentInterviewRecord(yaStudentInterviewRecord));
    }

    /**
     * 删除学生面试题练习记录
     */
    @RequiresPermissions("teaching:daily_tasks_record:remove")
    @Log(title = "学生面试题练习记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(yaStudentInterviewRecordService.deleteYaStudentInterviewRecordByIds(ids));
    }
}
